import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:jinke/utils/util.dart';

import '../index.dart';

/// hello
class OpenStepHeader extends GetView<ProOpenController> {
  const OpenStepHeader({Key? key}) : super(key: key);

  BrunoStepState _getState(int index) {
    if (controller.state.stepIndex < index) {
      return BrunoStepState.indexed;
    } else if (controller.state.stepIndex == index) {
      return BrunoStepState.doing;
    }
    return BrunoStepState.complete;
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      child: BrnHorizontalSteps(
          controller: controller.state.stepMan,
          steps: ['基本信息', '企业信息', '时限计划']
              .asMap()
              .map((key, value) => MapEntry(
                    key,
                    BrunoStep(
                      state: _getState(key),
                      stepContentText: value,
                      doingIcon: Container(
                        width: 24.r,
                        height: 24.r,
                        decoration: BoxDecoration(
                          color: ColorsUtil.blue,
                          border: Border.all(
                            width: 5.r,
                            color: const Color(0xffE5F3FE),
                          ),
                          borderRadius: BorderRadius.circular(12.r),
                        ),
                      ),
                    ),
                  ))
              .values
              .toList()),
    );
  }
}
